The invention relates to video processing methods, especially to video decoding method for decoding video data encoded using different encoding methods.
MPEG-4 is an ISO/IEC standard developed by MPEG (Moving Picture Experts Group), the committee that also developed the Emmy Award winning standards known as MPEG-1 and MPEG-2. MPEG-4 is the successor to MPEG-1 and MPEG-2 video standards. ISO standard committee implemented this standard in 1998. Instead of using current frame-based video technology, it adopts the object-oriented concept, which integrates existing multimedia technologies, such as 2D/3D graphic, animation, video codec, multimedia streaming, interactive, and programmatic environments into a single architecture.
The following describes video processing based on MPEG-4 format images.
A video stream is a sequence of video frames. Each frame is a still image. A video player displays one frame after another, usually at a rate close to 30 frames per second. Frames are divided into 16×16 pixel macroblocks (not shown). Each macroblock consists of four 8×8 luminance blocks and two 8×8 chrominance blocks (1 U and 1 V) (not shown). Macroblocks are the units for motion-compensated compression. Blocks are used for DCT compression.
Video data complying with MPEG-4 format files is composed of three different types of frames, comprising intra-frames (I-frames), forward predicted frames (P-frames), and bidirectional predicted frames (B-frames). An I-frame is encoded as a single image, with no reference to any past or future frames, referring to the fact that the various lossless and lossy compression techniques are performed relative to information that is contained only within the current frame, and not relative to any other frame in the video sequence. In other words, no temporal processing is performed outside of the current picture or frame. A P-frame is encoded relative to the past reference frame. A reference frame is a P- or I-frame. The past reference frame is the closest preceding reference frame. Each macroblock in a P-frame can be encoded either as an Intra-macroblock or as a Inter-macroblock. An Intra-macroblock is encoded just like a macroblock in an I-frame which is encoded with no reference. A B-frame is encoded relative to the past reference frame, the future reference frame, or both frames. The future reference frame is the closest following reference frame (I or P). The encoding for B-frames is similar to P-frames, except that motion vectors may refer to areas in the future reference frames. For macroblocks that use both past and future reference frames, the two 16×16 areas are averaged.
As described above, a video stream is a sequence of video frames. An input encoded sequence of video frames, for example, is represented as “I(0) P(3) B(1) B(2) P(6) B(4) B(5) I(9) B(7) B(8) P(12) B(11) P(12)” (the bracketed number is the display order of each frame). The output decoded sequence of the video frames is then represented as “I(0) B(1) B(2) P(3) B(4) B(5) P(6) B(7) B(8) I(9) B(10) B(11) P(12)”.
Video data can be further composed of combined frames, each comprising both a P-frame and a B-frame or an I-frame and a B-frame, and empty frames (Pe) Referring to FIG. 1, which shows a schematic diagram of a combined frame 100 (regarded as one frame to be introduced in the video data), comprising a P-frame and a B-frame, encoding processes of each frame are identical to independent ones. Pe frames indicate predicted frames not comprising video data.
The foregoing descriptions explain the types of frames of video data and input and output sequences in a video stream. Video data translated into playable video files must be encoded as MPEG-1/2/4, AVI, or other video formats due to the considerable file size. MPEG-4 video standards, however, are qualifiable based on MPEG-4 system layers, and vendors develop their coders/decoders (CODECs) based individual requirements, such that video data encoded by one CODEC cannot be correctly decoded by other CODECs. DivX and Divio are popular encoding and decoding applications, utilizing MPEG-4 encoding standards to encode video images with a high compression rate, resulting in high image quality closest to MPEG-2 file format and low file size closest to MPEG-1 file format.
Although the described CODECs claim to comply with MPEG-4 standards, their sampling synchronization mechanisms and output video sequences (as described above) are somewhat different, causing encoded video streams to be incompatible with each other. Some CODECs capable of decoding both of the described video sequences construct two decoding models for one video data and then determine whether the video data is encoded by Divx or Divio according to copyright information thereof. Such methods are not only time-consuming but also fail when the copyright information is modified or lost during decoding processes.
Thus, a video decoding method capable of correctly decoding video data encoded by any CODEC is desirable.